#include <iostream>
#include <string>
using namespace std;

class Solution
{
public:
    static string removeDuplicates(const string& s)
    {
        string rs;
        for(auto ch : s)
        {
            if(rs.empty() || rs.back() != ch)
            {
                rs += ch;
            }
            else
            {
                rs.pop_back();
            }
        }
        return rs;
    }
};
